/**
 *	The NeuroCoSA Toolkit
 *	Copyright (C) 2003-6 Stuart Meikle.
 *
 *	This is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation; either
 *	version 2.1 of the License, or (at your option) any later version.
 *
 *	This library is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	Lesser General Public License for more details.
 *
 * @author	Stuart Meikle
 * @version	2006-halloween(mk2)
 * @license	LGPL
 */
package org.stumeikle.NeuroCoSA.NIS;
import java.io.*;
import java.util.*;

/** Information types , for storing info in the brain info service.
 *  This one is a kind of publication. Contains a pointer to a wrapped long
 *  Changing name and package locn today. 20071212
 */
public	class	InfoLong extends Info
{
    class	LongObject
    {	long	l;
	LongObject(long a) { l=a; }
    }

    public InfoLong(String n, long num)
    {
	super(n);
	
	setValue( (Object) new LongObject(num) );
    }

    public long	getLongValue()
    {
	LongObject 	o = (LongObject)getValue();
	return o.l;
    }

    public void	incr()
    {   
	LongObject 	o = (LongObject)getValue();
	lock(this);
	o.l++;
	releaseAndNotify(this);
     }	//this will update subscribers. pointer hasn't actually changed. 

    public void	setValue( long l )
    {   
	LongObject 	o = (LongObject)getValue();
	lock(this);
	o.l=l;
	releaseAndNotify(this);
     }	//this will update subscribers. pointer hasn't actually changed. 

}

